import { defineStore } from "pinia";
import { ref } from "vue"

export let siderStore = defineStore("siderHook", () => {
    let collapse_ = ref(false)
    let clickNav = () => {
        console.log(!collapse_.value);

        return collapse_.value = !collapse_.value
    }

    let w = 800;
    // 封装一个函数 获取屏幕宽度
    let cptWidth = () => {
        // 获取屏幕宽度
        let Width = document.body.clientWidth;
        if (Width > w) {
            collapse_.value = false
        } else {
            collapse_.value = true
        }
    }
    // 监听 调用
    window.addEventListener("resize", cptWidth);

    return {
        clickNav,
        collapse_
    }
})


